<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>09_computed实现-getter</title>
  <!-- 引入Vue -->
  <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
  <!-- 准备好一个容器-->
  <div id="demo">
    姓:<input type="text" v-model=Fname><br>
    名:<input type="text" v-model=Lname><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
    姓名:<span>{{getFullName}}</span><br>
  </div>
</body>

<script type="text/javascript">
  new Vue({
    el: "#demo",
    data: {
      Fname: 'liu',
      Lname: 'haha'
    },
    methods: {},
    computed: {
      getFullName: {
        get() {
          console.log(111);
          return this.Fname.slice(0, 1).toUpperCase() + this.Fname.slice(1) + '-' + this.Lname
        },
      },
    }

  })
</script>

</html>